def shopping():
    print("购物选择如下：")
    print("1.进入购物界面")
    print("2.返回上一级")
    choose = int(input("请输入你的选择："))
    purchase = []
    if choose == 1:
        goods = {'f00001':{'name':'苹果', 'price':1.2}, 'f00002':{'name':'香蕉', 'price':5.5}, 'f00003':{'name':'桔子', 'price':3}}
        print(goods)
        if purchase == []:
            budget = input("请输入购物预算：")
        # else:
        #     budget = budget
        buy = input("请输入你的选择：")
        price = goods[buy]['price']
        if float(budget) < float(price):
            print("你的预算不足，请选择:")
            print("1.增加预算")
            print("2.退出系统")
            choose2 = input("你的选择为：")
            if choose2 == 1:
                budget2 = input("增加的预算为:")
                budget = budget2+budget
            else:
                print()
        else:
            budget = float(budget)-float(price)
            print("剩下预算为：", budget)
            purchase.append(goods[buy])
            print("购买列表如下", purchase)
            print("请你选择接下来的操作：")
            print("1.继续购物")
            print("2.退出系统并打印已购买的商品和余额")
            choose3 = input("请你做出选择：")
            if choose3 == 1:
                return choose
            else:
                print(purchase)
                print()

    else:
        print()

print("三乐购物系统欢迎你")
print("系统选择如下：")
print("1.用户登录")
print("2.退出系统")
choose = int(input("请输入你的选择："))
if choose == 1:
    name = input("请输入用户名字:")
    passwd = input("请输入用户密码:")
    if name == "root" and passwd == "123456":
        print("登录成功")
        shopping()
    else:
        print("密码或用户输入错误")
else:
    print()

